<!doctype html>  
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Update User</title>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
	
		<h1 align="center">Update User</h1>
		<form method="POST" action="<?=base_url()?>index.php/users/update_data">
			<input type="hidden" name="user_id" value="<?=$user->user_id?>" />
			<table>
				<tr>
					<td>Firstname: </td>
					<td>
						<input type="text" id="user_firstname" name="user_firstname" value="<?=$user->user_firstname?>" required/>
						<?php echo form_error('user_firstname','<p class="help-block" style="color:red">', '</p>'); ?>
					</td>
				</tr>
				<tr>
					<td>Middlename: </td>
					<td>
						<input type="text" id="user_middlename" name="user_middlename" value="<?=$user->user_middlename?>" required/>
						<?php echo form_error('user_middlename','<p class="help-block" style="color:red">', '</p>'); ?>
					</td>
				</tr>
				<tr>
					<td>Lastname: </td>
					<td>
						<input type="text" id="user_lastname" name="user_lastname" value="<?=$user->user_lastname?>" required/>
						<?php echo form_error('user_lastname','<p class="help-block" style="color:red">', '</p>'); ?>
					</td>
				</tr>
				<tr>
					<td>Gender: </td>
					<td>
						<select name='user_gender'>
							<option value='MALE'>Male</option>
							<option value='FEMALE'>Female</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>Email: </td>
					<td>
						<input type="email" id="user_email" name="user_email" value="<?=$user->user_email?>" required/>
						<?php echo form_error('user_email','<p class="help-block" style="color:red">', '</p>'); ?>
					</td>
				</tr>
				<tr>
					<td>Cellphone: </td>
					<td><input type="text" id="user_cellphone" name="user_cellphone" value="<?=$user->user_cellphone?>"/></td>
				</tr>
				<?php
					$pre_bday = $user->user_birthday;
					$bday = date("d/m/Y", strtotime($pre_bday));
				?>
				<tr>
					<td>Birthday: </td>
					<td><input type='date' name='user_birthday' value='<?=$bday?>'/></td>
				</tr>
					<td>Address: </td>
					<td><textarea id="user_address" name="user_address"><?=$user->user_address?></textarea></td>
				</tr>
					<td>City: </td>
					<td><input type='text' name='user_city' value="<?=$user->user_city?>"/></td>
				</tr>
					<td>Hometown: </td>
					<td><input type='text' name='user_hometown' value="<?=$user->user_hometown?>"/></td>
				</tr>
					<td>Country: </td>
					<td><input type='text' name='user_country' value="<?=$user->user_country?>"/></td>
				</tr>
				<tr>
					<td></td>
					<td>
						<a title="Change Password" href="<?=base_url() . 'index.php/users/change_password?&id=' . $user->user_id?>">Change Password</a>
						<a title="Delete" style='display:none' href="<?=base_url() . 'index.php/users/delete_user?&id=' . $user->user_id?>">Delete User</a>
					</td>
				</tr>
				<tr>
					<td></td>
					<td>
						<input type="submit" value="Save"/>
						<input type='button' value="Cancel" onclick='javascript:window.location = "<?=base_url()?>index.php/users/view_user?&id=<?=$user->user_id?>"'/>
					</td>
				</tr>
			</table>
		</form>
</body>
</html>
